package jmvm.schemes;


import java.awt.Point;
import java.util.ArrayList;

import jmvm.components.*;
import jmvm.gui.GuiLabel;
import jmvm.gui.GuiLine;
import jmvm.gui.GuiScheme;


public class UpravljackaJedinica { // izmena: uklonjen CW registar prakticno
	
	//
	public static IntToBools  CW_0_7Bits, CW_8_15Bits;
	//
	
	public static KMOPR2 kmopr;
	public static KMADR2 kmadr;
	public static MP mp;
	public static REG mPC;	
	public static OR mPC_OR;
	public static NOT NOT_mPC_OR;
	public static MicroMemory mMEM;
	/////////////////////////////////////////////////////////////////////////////public static REG CW_0_7, CW_8_15, CW_16_23;
	
	////////////
	//////////// Grafika
	////////////
	
	public static GuiScheme gui;

	public static GuiScheme getGui() {
		return gui;
	}
	
	public static void gui() {

		GuiLine line; // Pomocna promenljiva
		gui = new GuiScheme("jmvm/jmvm/images/UpravljackaJedinica.png");
		
		ArrayList<ArrayList<Point>> sections;
		ArrayList<Point> points;
		
		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(143,136));
		points.add(new Point(143,191));
		sections.add(points);
		line=new GuiLine(sections,kmopr.getOut(0));
		gui.addLine(line);

		//
		//

		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(320,136));
		points.add(new Point(320,163));
		points.add(new Point(179,163));
		points.add(new Point(179,191));
		sections.add(points);
		line=new GuiLine(sections,kmadr.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(245,488));
		points.add(new Point(245,506));
		points.add(new Point(449,506));
		points.add(new Point(449,172));
		points.add(new Point(214,172));
		points.add(new Point(214,191));
		sections.add(points);
		line=new GuiLine(sections,mMEM.getOut(2));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(161,231));
		points.add(new Point(161,267));
		sections.add(points);
		line=new GuiLine(sections,mp.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(161,307));
		points.add(new Point(161,343));
		sections.add(points);
		line=new GuiLine(sections,mPC.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(325,270));
		points.add(new Point(317,270));
		sections.add(points);
		line=new GuiLine(sections,UpravUprav.bradr());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(315,281));
		points.add(new Point(325,281));
		sections.add(points);
		line=new GuiLine(sections,UpravUprav.bropr());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(315,292));
		points.add(new Point(325,292));
		sections.add(points);
		line=new GuiLine(sections,UpravUprav.bruncnd());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(317,304));
		points.add(new Point(325,304));
		sections.add(points);
		line=new GuiLine(sections,UpravUprav.brcnd());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(289,287));
		points.add(new Point(281,287));
		points.add(new Point(281,277));
		points.add(new Point(241,277));
		sections.add(points);
		line=new GuiLine(sections,mPC_OR.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(280,288));
		points.add(new Point(280,296));
		points.add(new Point(247,296));
		sections.add(points);
		line=new GuiLine(sections,mPC_OR.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(88,77));
		points.add(new Point(88,86));
		sections.add(points);
		line=new GuiLine(sections,Fetch2.NOP());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(106,77));
		points.add(new Point(106,86));
		sections.add(points);
		line=new GuiLine(sections,Fetch2.HALT());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(199,77));
		points.add(new Point(199,86));
		sections.add(points);
		line=new GuiLine(sections,Fetch2.RTS());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(265,77));
		points.add(new Point(265,86));
		sections.add(points);
		line=new GuiLine(sections,Fetch2.regdir());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(283,77));
		points.add(new Point(283,86));
		sections.add(points);
		line=new GuiLine(sections,Fetch2.regind());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(376,77));
		points.add(new Point(376,86));
		sections.add(points);
		line=new GuiLine(sections,Fetch2.imm());
		gui.addLine(line);

		//
		//
		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(68,489));
		points.add(new Point(68,534));
		points.add(new Point(125,534));
		points.add(new Point(125,543));
		sections.add(points);
		line=new GuiLine(sections,mMEM.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(157,488));
		points.add(new Point(157,534));
		points.add(new Point(449,534));
		points.add(new Point(449,543));
		sections.add(points);
		line=new GuiLine(sections,mMEM.getOut(1));
		gui.addLine(line);

		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(319,452));
		points.add(new Point(328,452));
		sections.add(points);
		line=new GuiLine(sections,new Pin(true));
		gui.addLine(line);

		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(242,201));
		points.add(new Point(251,201));
		sections.add(points);
		line=new GuiLine(sections,UpravUprav.bradr());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(242,220));
		points.add(new Point(250,220));
		sections.add(points);
		line=new GuiLine(sections,UpravUprav.bropr());
		gui.addLine(line);

		//
		//

		
		gui.addLabel(new GuiLabel(120, 160, kmopr.getOut(0)));
		gui.addLabel(new GuiLabel(220, 160, kmadr.getOut(0)));
		gui.addLabel(new GuiLabel(452, 225, mMEM.getOut(2)));
		gui.addLabel(new GuiLabel(162, 513, mMEM.getOut(1)));
		gui.addLabel(new GuiLabel(72, 513, mMEM.getOut(0)));
		gui.addLabel(new GuiLabel(168, 248, mp.getOut(0)));
		gui.addLabel(new GuiLabel(168, 331, mPC.getOut(0)));



	}
	/////////////
	/////////////
	/////////////
	
	public static void init(){
		
		///
		CW_0_7Bits = new IntToBools(8,8);
		CW_8_15Bits = new IntToBools(8,8);
		///
		
		kmopr = new KMOPR2(); 
		kmopr.getOut(0).setNumOfLines(8);
		
		kmadr = new KMADR2();
		kmadr.getOut(0).setNumOfLines(8);
		
		//////// MULTIPLEKSER
		
		mp = new MP(4);
		mp.getOut(0).setNumOfLines(8);
		mp.getOut(0).setIsInt();
		
		//////// REGISTAR ZA ADRESIRANJE MIKRO MEMORIJE
		
		mPC = new REG(1,"mPC");
		mPC.getOut(0).setNumOfLines(8);
		mPC.getOut(0).setIsInt();
		
		mPC_OR = new OR(4);
		NOT_mPC_OR = new NOT();
		
		/////// MIKRO MEMORIJA
		
		mMEM = new MicroMemory(512);		// 512 sam lupio, treba tacan broj mikroinstrukcija
		mMEM.init("conf/jmvm/MicroMemoryContent");
		
		//////// CW registar se sastoji iz tri manja
		
		/*
		CW_16_23 = new REG(1,"CW_23_16");
		CW_16_23.getOut(0).setNumOfLines(8);
		CW_16_23.getOut(0).setIsInt();
		
		CW_8_15 = new REG(1,"CW_15_8");
		CW_8_15.getOut(0).setNumOfLines(8);
		CW_8_15.getOut(0).setIsInt();
		
		CW_0_7 = new REG(1,"CW_7_0");
		CW_0_7.getOut(0).setNumOfLines(8);
		CW_0_7.getOut(0).setIsInt();
		*/
		
	}
	
	public static void connect(){
		
		///
		///////////////////////////////////////////////////////////////CW_0_7Bits.setInputPin(0, CW_0_7.getOut(0));
		///////////////////////////////////////////////////////////////CW_8_15Bits.setInputPin(0, CW_8_15.getOut(0));
		CW_0_7Bits.setInputPin(0, mMEM.getOut(0));
		CW_8_15Bits.setInputPin(0, mMEM.getOut(1));
		///
		
		
		//////// KMOPR
		
		kmopr.setInputPin(0, Fetch2.NOP());
		kmopr.setInputPin(1, Fetch2.HALT());
		kmopr.setInputPin(2, Fetch2.INTD());
		kmopr.setInputPin(3, Fetch2.INTE());
		kmopr.setInputPin(4, Fetch2.TRPD());
		kmopr.setInputPin(5, Fetch2.TRPE());
		kmopr.setInputPin(6, Fetch2.LDB());
		kmopr.setInputPin(7, Fetch2.LDW());
		kmopr.setInputPin(8, Fetch2.STB());
		kmopr.setInputPin(9, Fetch2.STW());
		kmopr.setInputPin(10, Fetch2.POPB());
		kmopr.setInputPin(11, Fetch2.POPW());
		
		kmopr.setInputPin(12, Fetch2.PUSHB());
		kmopr.setInputPin(13, Fetch2.PUSHW());
		kmopr.setInputPin(14, Fetch2.LDIVTP());
		kmopr.setInputPin(15, Fetch2.STIVTP());
		kmopr.setInputPin(16, Fetch2.LDIMR());
		kmopr.setInputPin(17, Fetch2.STIMR());
		kmopr.setInputPin(18, Fetch2.LDSP());
		kmopr.setInputPin(19, Fetch2.STSP());
		kmopr.setInputPin(20, Fetch2.ADD());
		
		
		kmopr.setInputPin(21, Fetch2.SUB());
		kmopr.setInputPin(22, Fetch2.INC());
		kmopr.setInputPin(23, Fetch2.DEC());
		kmopr.setInputPin(24, Fetch2.AND());
		kmopr.setInputPin(25, Fetch2.OR());
		kmopr.setInputPin(26, Fetch2.XOR());
		kmopr.setInputPin(27, Fetch2.NOT());
		kmopr.setInputPin(28, Fetch2.ASR());
		kmopr.setInputPin(29, Fetch2.LSR());
		kmopr.setInputPin(30, Fetch2.ROR());
		kmopr.setInputPin(31, Fetch2.RORC());
		
		kmopr.setInputPin(32, Fetch2.ASL());
		kmopr.setInputPin(33, Fetch2.LSL());
		kmopr.setInputPin(34, Fetch2.ROL());
		kmopr.setInputPin(35, Fetch2.ROLC());
		kmopr.setInputPin(36, Fetch2.BEQL());
		kmopr.setInputPin(37, Fetch2.BNEQL());
		kmopr.setInputPin(38, Fetch2.BNEG());
		kmopr.setInputPin(39, Fetch2.BNNEG());
		kmopr.setInputPin(40, Fetch2.BOVF());
		kmopr.setInputPin(41, Fetch2.BNOVF());
		
		kmopr.setInputPin(42, Fetch2.BCAR());
		kmopr.setInputPin(43, Fetch2.BNCAR());
		kmopr.setInputPin(44, Fetch2.BGRT());
		kmopr.setInputPin(45, Fetch2.BGRTE());
		kmopr.setInputPin(46, Fetch2.BLSS());
		kmopr.setInputPin(47, Fetch2.BLSSE());
		kmopr.setInputPin(48, Fetch2.BGRTU());
		
		kmopr.setInputPin(49, Fetch2.BGRTEU());
		kmopr.setInputPin(50, Fetch2.BLSSU());
		kmopr.setInputPin(51, Fetch2.BLSSEU());
		kmopr.setInputPin(52, Fetch2.JMP());
		kmopr.setInputPin(53, Fetch2.INT());
		kmopr.setInputPin(54, Fetch2.JSR());
		kmopr.setInputPin(55, Fetch2.RTI());
		kmopr.setInputPin(56, Fetch2.RTS());
		
		//////// KMADR
		
		kmadr.setInputPin(0, Fetch2.regdir());
		kmadr.setInputPin(1, Fetch2.regind());
		kmadr.setInputPin(2, Fetch2.memdir());
		kmadr.setInputPin(3, Fetch2.memind());
		kmadr.setInputPin(4, Fetch2.regindpom());
		kmadr.setInputPin(5, Fetch2.bxpom());
		kmadr.setInputPin(6, Fetch2.pcpom());
		kmadr.setInputPin(7, Fetch2.imm());
		
		/////////////////////////////////////////////////////////////////////////
		
		/////////////////////////////////////////////////////////////////////////mp.setInputPin(0, CW_16_23.getOut(0) );
		mp.setInputPin(0, mMEM.getOut(2) );
		mp.setInputPin(1, kmadr.getOut(0));
		mp.setInputPin(2, kmopr.getOut(0));
		mp.setInputPin(3, new Pin(false));
		mp.setCtrl(0, UpravUprav.bradr());
		mp.setCtrl(1, UpravUprav.bropr());
		
		/////////////////////////////////////////////////////////////////////////
		
		mPC_OR.setInputPin(0, UpravUprav.bradr());
		mPC_OR.setInputPin(1, UpravUprav.bropr());
		mPC_OR.setInputPin(2, UpravUprav.bruncnd());
		mPC_OR.setInputPin(3, UpravUprav.brcnd());
		NOT_mPC_OR.setInputPin(0, mPC_OR.getOut(0) );
		
		mPC.setInputPin(0, mp.getOut(0));
		mPC.setPinLd(mPC_OR.getOut(0));
		mPC.setPinInc(NOT_mPC_OR.getOut(0));
		
		//////////////////////////////////////////////////////////////////////////
		
		mMEM.setInputPin(0, mPC.getOut(0));
		
		//////////////////////////////////////////////////////////////////////////
		
		/*
		CW_16_23.setInputPin(0, mMEM.getOut(2));
		CW_16_23.setPinLd( new Pin(true));
		
		CW_8_15.setInputPin(0, mMEM.getOut(1));
		CW_8_15.setPinLd( new Pin(true));
		
		CW_0_7.setInputPin(0, mMEM.getOut(0));
		CW_0_7.setPinLd( new Pin(true));
		*/
		
	}
	
	
	
	
	public static void ispisiOperSignale() {
		
		
		System.out.print("\n Aktivni operacioni  signali: ");
		
		if (UpravOper.rdCPU().getBoolVal()) System.out.print(" rdCPU ");
		if (UpravOper.wrCPU().getBoolVal()) System.out.print(" wrCPU ");
		if (UpravOper.ldMDR().getBoolVal()) System.out.print(" ldMDR ");
		if (UpravOper.mxMDR0().getBoolVal()) System.out.print(" mxMDR0 ");
		if (UpravOper.MDRout().getBoolVal()) System.out.print(" MDRout ");
		if (UpravOper.eMDR().getBoolVal()) System.out.print(" eMDR ");
		if (UpravOper.ldMAR().getBoolVal()) System.out.print(" ldMAR ");
		if (UpravOper.incMAR().getBoolVal()) System.out.print(" incMAR ");
		if (UpravOper.eMAR().getBoolVal()) System.out.print(" eMAR ");
		if (UpravOper.ldDWL().getBoolVal()) System.out.print(" ldDWL ");
		if (UpravOper.ldDWH().getBoolVal()) System.out.print("Signal ldDWH ");
		if (UpravOper.DWout().getBoolVal()) System.out.print(" DWout ");
		if (UpravOper.ldPC().getBoolVal()) System.out.print(" ldPC ");
		if (UpravOper.incPC().getBoolVal()) System.out.print(" incPC ");
		if (UpravOper.PCHout().getBoolVal()) System.out.print(" PCHout ");
		if (UpravOper.PCout().getBoolVal()) System.out.print(" PCout ");
		if (UpravOper.ldIR0().getBoolVal()) System.out.print(" ldIR0 ");
		if (UpravOper.ldIR1().getBoolVal()) System.out.print(" ldIR1 ");
		if (UpravOper.ldIR2().getBoolVal()) System.out.print(" ldIR2 ");
		if (UpravOper.ldIR3().getBoolVal()) System.out.print(" ldIR3 ");
		if (UpravOper.IRPOMout().getBoolVal()) System.out.print(" IRPOMout ");
		if (UpravOper.IRJAout().getBoolVal()) System.out.print(" IRJAout ");
		
		if (UpravOper.IRDAout().getBoolVal()) System.out.print(" IRDAout ");
		if (UpravOper.IRBRout().getBoolVal()) System.out.print(" IRBRout ");
		if (UpravOper.wrGPR().getBoolVal()) System.out.print(" wrGPR ");
		if (UpravOper.GPRout().getBoolVal()) System.out.print(" GPRout ");
		if (UpravOper.ldGPRAR().getBoolVal()) System.out.print(" ldGPRAR ");
		if (UpravOper.incGPRAR().getBoolVal()) System.out.print(" incGPRAR ");
		if (UpravOper.ldSP().getBoolVal()) System.out.print(" ldSP ");
		if (UpravOper.SPout().getBoolVal()) System.out.print(" SPout ");
		if (UpravOper.incSP().getBoolVal()) System.out.print(" incSP ");
		if (UpravOper.decSP().getBoolVal()) System.out.print(" decSP ");
		if (UpravOper.ldCW().getBoolVal()) System.out.print(" ldCW ");
		if (UpravOper.ldCW1().getBoolVal()) System.out.print(" ldCW1 ");
		if (UpravOper.ADDout().getBoolVal()) System.out.print(" ADDout ");
		
		if (UpravOper.add().getBoolVal()) System.out.print(" add ");
		if (UpravOper.sub().getBoolVal()) System.out.print(" sub ");
		if (UpravOper.inc().getBoolVal()) System.out.print(" inc ");
		if (UpravOper.dec().getBoolVal()) System.out.print(" dec ");
		if (UpravOper.and().getBoolVal()) System.out.print(" and ");
		if (UpravOper.or().getBoolVal()) System.out.print(" or ");
		if (UpravOper.xor().getBoolVal()) System.out.print(" xor ");
		if (UpravOper.not().getBoolVal()) System.out.print(" not ");
		if (UpravOper.ALUout().getBoolVal()) System.out.print(" ALUout ");
		if (UpravOper.ldAB().getBoolVal()) System.out.print(" ldAB ");
		if (UpravOper.ABout().getBoolVal()) System.out.print(" ABout ");
		if (UpravOper.shr().getBoolVal()) System.out.print(" shr ");
		if (UpravOper.shl().getBoolVal()) System.out.print(" shl ");
		if (UpravOper.ldBB().getBoolVal()) System.out.print(" ldBB ");
		if (UpravOper.BBout().getBoolVal()) System.out.print(" BBout ");
		if (UpravOper.ldAW().getBoolVal()) System.out.print(" ldAW ");
		if (UpravOper.AWout().getBoolVal()) System.out.print(" AWout ");
		if (UpravOper.AWHout().getBoolVal()) System.out.print(" AWHout ");
		if (UpravOper.ldBW().getBoolVal()) System.out.print(" ldBW ");
		if (UpravOper.BWout().getBoolVal()) System.out.print(" BWout ");
		if (UpravOper.ldPSWH().getBoolVal()) System.out.print(" ldPSWH ");
		if (UpravOper.ldPSWL().getBoolVal()) System.out.print(" ldPSWL ");
		if (UpravOper.ldN().getBoolVal()) System.out.print(" ldN ");
		if (UpravOper.ldZ().getBoolVal()) System.out.print(" ldZ ");
		if (UpravOper.ldC().getBoolVal()) System.out.print(" ldC ");
		if (UpravOper.ldV().getBoolVal()) System.out.print(" ldV ");
		if (UpravOper.ldL().getBoolVal()) System.out.print(" ldL ");
		if (UpravOper.stPSWI().getBoolVal()) System.out.print(" stPSWI ");
		if (UpravOper.clPSWI().getBoolVal()) System.out.print(" clPSWI ");
		if (UpravOper.stPSWT().getBoolVal()) System.out.print(" stPSWT ");
		if (UpravOper.clPSWT().getBoolVal()) System.out.print(" clPSWT ");
		if (UpravOper.PSWHout().getBoolVal()) System.out.print(" PSWHout ");
		if (UpravOper.PSWLout().getBoolVal()) System.out.print(" PSWLout ");
		if (UpravOper.clSTART().getBoolVal()) System.out.print(" clSTART ");
		
		if (UpravOper.ldIMR().getBoolVal()) System.out.print(" ldIMR ");
		if (UpravOper.IMRout().getBoolVal()) System.out.print(" IMRout");
		if (UpravOper.ldBR().getBoolVal()) System.out.print(" ldBR ");
		if (UpravOper.IVTDSPout().getBoolVal()) System.out.print(" IVTDSPout ");
		if (UpravOper.ldIVTP().getBoolVal()) System.out.print(" ldIVTP ");
		if (UpravOper.IVTPout().getBoolVal()) System.out.print(" IVTPout ");
		if (UpravOper.UINTout().getBoolVal()) System.out.print(" UINTout ");
		if (UpravOper.UEXTout().getBoolVal()) System.out.print(" UEXTout ");
		if (UpravOper.stPRCOD().getBoolVal()) System.out.print(" stPRCOD ");
		if (UpravOper.stPRADR().getBoolVal()) System.out.print(" stPRADR ");
		if (UpravOper.stPRINS().getBoolVal()) System.out.print(" stPRINS ");
		if (UpravOper.clPRCOD().getBoolVal()) System.out.print(" clPRCOD ");
		if (UpravOper.clPRADR().getBoolVal()) System.out.print(" clPRADR ");
		if (UpravOper.clPRINS().getBoolVal()) System.out.print(" clPRINS ");
		if (UpravOper.clPRINM().getBoolVal()) System.out.print(" clPRINM ");
		if (UpravOper.clINTR().getBoolVal()) System.out.print(" clINTR ");
		
		System.out.println();
		System.out.println();
		
		
	}
	
	
	public static void ispisiUpravSignale() {
		
		System.out.print("\n Aktivni upravljacki signali: ");
		
		if (UpravUprav.brnotstart().getBoolVal()) System.out.print(" brnotstart ");
		if (UpravUprav.brhack().getBoolVal()) System.out.print(" brhack ");
		if (UpravUprav.brnotfcCPU().getBoolVal()) System.out.print(" brnotfcCPU ");
		if (UpravUprav.brnotgropr().getBoolVal()) System.out.print(" brnotgropr ");
		if (UpravUprav.brl1().getBoolVal()) System.out.print(" brl1 ");
		if (UpravUprav.brnotgradr().getBoolVal()) System.out.print(" brnotgradr ");
		if (UpravUprav.brl2_brnch().getBoolVal()) System.out.print(" brl2_brnch ");
		if (UpravUprav.brl2_arlog().getBoolVal()) System.out.print(" brl2_arlog ");
		if (UpravUprav.brl3_jump().getBoolVal()) System.out.print(" brl3_jump ");
		if (UpravUprav.brl3_arlog().getBoolVal()) System.out.print(" brl3_arlog ");
		if (UpravUprav.brstore().getBoolVal()) System.out.print(" brstore ");
		if (UpravUprav.brLDW().getBoolVal()) System.out.print(" brLDW ");
		if (UpravUprav.brregdir().getBoolVal()) System.out.print(" brregdir ");
		if (UpravUprav.brnotbrpom().getBoolVal()) System.out.print(" brnotbrpom ");
		if (UpravUprav.brnotprekid().getBoolVal()) System.out.print(" brnotprekid ");
		if (UpravUprav.brnotPRINS().getBoolVal()) System.out.print(" brnotPRINS ");
		if (UpravUprav.brnotPRCOD().getBoolVal()) System.out.print(" brnotPRCOD ");
		if (UpravUprav.brnotPRADR().getBoolVal()) System.out.print(" brnotPRADR ");
		if (UpravUprav.brnotPRINM().getBoolVal()) System.out.print(" brnotPRINM ");
		if (UpravUprav.brnotprintr().getBoolVal()) System.out.print(" brnotprintr ");
		
		if (UpravUprav.bruncnd().getBoolVal()) System.out.print(" | Ispunjen skok:  Bezuslovni Skok bruncnd");
		if (UpravUprav.bradr().getBoolVal()) System.out.print(" | Ispunjen skok: Visestruki Uslovni Skok bradr");
		if (UpravUprav.bropr().getBoolVal()) System.out.print(" | Ispunjen skok: Visestruki Uslovni Skok bropr");
		if (UpravUprav.brcnd().getBoolVal()) System.out.print(" | Ispunjen skok: Uslovni Skok brcnd");
		
		System.out.println();
	}
	
	public static void ispisiMagistrale() {
		
		System.out.print("\n Magistrale: " + "IBUS:" + Bus.IBUS().getIntVal() + " ABUS:" + Bus.ABUS().getIntVal() + " DBUS:" + Bus.DBUS().getIntVal()
				+ " NotFCBUS:" + Bus.NotFCBUS().getBoolVal() + " NotRDBUS:" + Bus.NotRDBUS().getBoolVal()+ " NotWRBUS:" + Bus.NotWRBUS().getBoolVal() );
		System.out.println("     HIGH_Z ??: " + "IBUS:" + Bus.IBUS().isHighZ() + " ABUS:" + Bus.ABUS().isHighZ() + " DBUS:" + Bus.DBUS().isHighZ()
				+ " NotFCBUS:" + Bus.NotFCBUS().isHighZ() + " NotRDBUS:" + Bus.NotRDBUS().isHighZ()+ " NotWRBUS:" + Bus.NotWRBUS().isHighZ() );
		
	}
	
	public static void ispisiIzlazMM() {
		System.out.println(" Izlaz MikroMemorije: "+Integer.toHexString(mMEM.getOut(0).getIntVal()) + " "
				+Integer.toHexString(mMEM.getOut(1).getIntVal())+ " " + Integer.toHexString(mMEM.getOut(2).getIntVal()));
	}
	

}
